<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<?php 
include_once "config/config.php"; 
include_once "functions/genericfunctions.php";
include_once "functions/drawTables.php";
include_once "functions/drawCode.php";
include_once "InsertData_brains.php";

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>SQL mokomasis puslapis</title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <link type="text/css" rel="stylesheet" media="all" href="css/styles.css" />
    <script src="scripts/modernizr-2.0.4.js"></script>
</head>
<body>
    <div id="page-wrapper">
        <div id="page">
            <?php 
/*
                        	
            	$isAuth = isset($_SESSION) && isset($_SESSION[USER_ID_KEY]);
            	if ($isAuth) { include('header1.php'); }
				else { include('header.php'); }
*/            	
//            	$currentClient = $_SESSION[USER_ID_KEY];
				$_SESSION['psl']=4;            	
            	include('header1.php');
/*
				$stud = $currentClient->isInRole('ST');
				if ($stud)
					die('studentas');
 *
 */
            ?>
            <div class="content">
                <div class="left-side">
                    <?php include('menu-left.html'); ?>
                </div>
                <div class="right-side"> 

	            		 <?php
	            		 
							if(!empty($_SESSION['langas'])) { }
							else { $_SESSION['langas'] = ''; }
							$_SESSION['insdata'] = GetUzduotis($insertdata_name, $workDB);
								            		 	            		 
	            		 	$patterns = array('/\@Lentele_Insert1/', 
	            		 					  '/\@Lentele_Insert2/',
											  '/\@Kodas_Insert1/',
											  '/\@Kodas_Insert2/',
											  '/\@Kodas_Insert3/',
											  '/\@INSERT_uzduotis/',
											  '/\@INSERT_uzdTblAttr/');
							$replacements = array(printTblInsert1($workDB), 
	            		 					      drawInsertResult($tempDB),
											      printCodeInsert1(),
											      printCodeInsert2(),
											      printCodeInsert3(),
												  $_SESSION['insdata']['salyga'],
												  drawAttrTable($_SESSION['insdata']['pavadinimas']));
	
	            		 	print preg_replace($patterns, $replacements, getTexts($_SESSION['psl'], $workDB));
						  ?>
						<div>
					        <form class="forma" action="insertQueryINSERT.php" method="post">
					            <table>
					                <tr><td><textarea cols="50" rows="10" name="sql_code"></textarea></td></tr>
					                <tr><td style="text-align:right;"><input type="submit" value="Įterpti" /></td></tr>
					            </table>
					        </form>
					
						</div>
					 


            



                 </div>
              
            </div>
            <?php include('footer.html'); ?>
        </div>
    </div>
    <input type="hidden" id="hid" />

    <script src="http://code.jquery.com/jquery-latest.js"></script>

    <script type="text/javascript" src="scripts/navigacija.js"></script> 	

</body>
</html>